package com.building.hcrm.common;

import android.R.integer;
import android.util.SparseArray;
import android.view.KeyEvent;
import android.view.View;

/**
 * 对控件额外进行控制
 */
public class Utils {
	private static int _interval = 500;
	private static long lastClickTime;
	/**
	 * 是否是快速的进行双击
	 * @return
	 */
	public static boolean isFastDoubleClick() {
		long time = System.currentTimeMillis();
		long timeD = time - lastClickTime;
		
		if (0 < timeD && timeD < _interval)
			return true;
		else
			lastClickTime = time;
		
		return false;
	}
	/**
	 * 是否是快速点击物理键
	 * @return
	 */
	public static boolean isFastClickKey() {
		long time = System.currentTimeMillis();
		long timeD = time - lastClickTime;
		
		if (0 < timeD && timeD < _interval)
			return true;
		else
			lastClickTime = time;
		return false;
	}
	/**
	 * 是否是快速点击指定物理键
	 * @return
	 */
	public static boolean isFastClickKey(int keyCode) {
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			long time = System.currentTimeMillis();
			long timeD = time - lastClickTime;
			
			if (0 < timeD && timeD < _interval)
				return true;
			else
				lastClickTime = time;
		}
		return false;
	}
}
